package com.zc.study.designPattern.行为型设计模式.VisitorPattern;

import com.zc.initConstructor.Obser;

import java.util.ArrayList;

/**
 * 员工列表类:对象结构
 */
public class EmployeeList {
    //定义一个集合用于存储员工对象
    private ArrayList<Employee> list = new ArrayList<>();

    public void addEmployee(Employee employee) {
        list.add(employee);
    }

    //遍历查询员工集合中的每一个员工对象
    public void accept(Department handler) {
        for (Object obj : list) {
            ((Employee) obj).accept(handler);
        }
    }
}
